﻿//操作会员7加入组5离开组
function OPMember(op,reMemberno)
{
    if(__P_M=="")
    {
        top.location = "/user/login.htm";return;
    }
    switch(op)
    {
        case 9:
            op=1;
            break;
        case -9:
            op=3;
            break;
        case 8:
            op=2;
            break;
        case -8:
            op=4;
            break;
    }
    $("OPID").value = op;
    $("ReMID").value = reMemberno;
    $("Form1").action = "/groups/"+groupID+"/members-"+pageIndex+"-"+sortOrder+".htm?Flag=t";
    $("Form1").submit();
}
//加入组 joinOptions=组的joinOptions
function JoinGroup(joinOptions)
{
    if(__P_M==""){top.location = "/user/login.htm?IsShow=1&ReturnUrl=/groups/"+groupID+"/members-"+pageIndex+"-"+sortOrder+".htm"; return;}
    if(joinOptions==2)
    {
        showProgressBar(false,true);
        $("$divIput$").style.display = "none";
        var joinDesc1="<div style='width:370px; overflow:hidden'>"+joinDesc+"</div><br/><div class='Popup_button'><input value='"+GP232+"' class='button' onclick='opWebSerJoin()' type='button'/>&nbsp;&nbsp;<input type='button' value='"+C0056+"' class='buttong' onclick='webFailure()' /></div>";   
        var obj = {}
        $ShowMessageBox$(joinTitle,joinDesc1,obj,webFailure,400);    
    }
    else
    {
        showProgressBar(false,true);
        $("$divIput$").style.display = "none";
        var joDesc1="<div style='width:370px; overflow:hidden'>"+joDesc+"</div><br/><div class='Popup_button'><input value='"+GP231+"' class='button' onclick='ExeOperate(7,\"T\")' type='button'/>&nbsp;&nbsp;<input type='button' value='"+C0056+"' class='buttong' onclick='webFailure()' /></div>";   
        var obj = {}
        $ShowMessageBox$(joinTitle,joDesc1,obj,webFailure,400);
        //OPMember(7,"T");
    }
}
//离开组
function LeaveGroup(memberno)
{
    if(__P_M=="")
    {
        top.location = "/user/login.htm";return;
    }
    showProgressBar(false,true);
    $("$divIput$").style.display = "none";
    var leaveDesc="<div style='width:370px; overflow:hidden'>"+GP115.replace(/\{0\}/gi,groupTitle)+"</div><br/><div class='Popup_button'><input value='"+GP230+"' class='button' onclick='ExeOperate(5,\""+memberno+"\")' type='button'/>&nbsp;&nbsp;<input type='button' value='"+C0056+"' class='buttong' onclick='webFailure()' /></div>";   
    var obj = {}
    $ShowMessageBox$(leaveTitle,leaveDesc,obj,webFailure,400);
}
//执行操作
function ExeOperate(op,rm)
{ 
    OPMember(op,rm);
    $EndMessageBox$();
}
//执行
function opWebSerJoin()
{
    WebServices.WWW.Groups.JoinGroup(groupID,nickName,groupTitle,onsuccGroup,webFailure);
}

function onsuccGroup(result,op)
{
    $EndMessageBox$();
}
//调用webService方法失败
function webFailure()
{
    $EndMessageBox$();
}
//申请管理员
function AppAdmin()
{
    if(__P_M==""){$Login$();return;}
    showProgressBar(false,true);
    $("$divIput$").style.display = "none";
    var appAdminBody=GP116+":<br/><div id='AppAdminError' style='display:none' class='red10'>"+ST155+"</div><textarea id='AppAdminInfo' rows='5' class='common100D'></textarea><br/><div class='Popup_button'><input id='btnAppAdmin' value='"+GP224+"' class='button' onclick='opWebSerAppAdmin()' type='button'/>&nbsp;&nbsp;<input type='button' value='"+C0056+"' class='buttong' onclick='webFailure()' /></div>";   
    var obj = {}
    $ShowMessageBox$(appAdminTitle,appAdminBody,obj,webFailure);
}
function opWebSerAppAdmin()
{
    var message=$("AppAdminInfo").value;
    if(message.length<3||message.length>1000)
    {
        $("AppAdminError").style.display = ""
        return;
    }
    $("AppAdminError").style.display = "none"
    WebServices.WWW.Groups.AppAdmin(groupID,nickName,groupTitle,message,onsuccGroup,webFailure);      
}
